package service.impl;

import mapper.SysRoleMapper;
import org.springframework.stereotype.Service;
import pojo.SysRole;
import service.SysRoleService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysRoleServiceImpl implements SysRoleService {
    @Resource
    private SysRoleMapper sysRoleMapper;
    @Override
    public List<SysRole> getRoles() {
        return sysRoleMapper.getRoles();
    }

    @Override
    public int add(SysRole role) {
        int result = 0;
        try{
            if(sysRoleMapper.add(role)>0){
                result = 1;
            }
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
        return result;
    }
}
